﻿namespace DotNetUtility.GenericDesignPattern.Test
{
    using System;
    using System.Collections.Generic;
    using DotNetUtility.GenericDesignPattern;
    using NUnit.Framework;

    [TestFixture]
    public class StrategyOfTypeSelectionTest
    {
        enum MyEnum
        {
            One,
            Two
        }

        [Test]
        public void StrategyOfMethodSelection()
        {
            StrategyOfTypeSelection<MyEnum, IBusinessRule> strategyOfSelection = new StrategyOfTypeSelection<MyEnum, IBusinessRule>(
                                                    new Dictionary<MyEnum, IBusinessRule>() 
                                                         {
                                                             {MyEnum.One, new BusinessRuleImplementionOne()},
                                                             {MyEnum.Two, new BusinessRuleImplementionTwo()}
                                                         }
                                                    );
            var objectOne = strategyOfSelection.GetBusinessType(MyEnum.One);
            var objectTwo = strategyOfSelection.GetBusinessType(MyEnum.Two);
        }
    }




    public interface IBusinessRule
    {
        void MethodOne(string item);
    }
    public class BusinessRuleImplementionOne : IBusinessRule
    {
        public void MethodOne(string item)
        {
            Console.WriteLine(item);
        }
    }

    public class BusinessRuleImplementionTwo : IBusinessRule
    {
        public void MethodOne(string item)
        {
            Console.WriteLine(item);
        }
    }
}
